load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "workloadlearning",
    srcs = [
        "cache.go",
        "handle.go",
        "metrics.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/workloadlearning",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/infoschema",
        "//pkg/kv",
        "//pkg/parser/ast",
        "//pkg/parser/mysql",
        "//pkg/sessionctx",
        "//pkg/sessiontxn",
        "//pkg/util",
        "//pkg/util/logutil",
        "//pkg/util/plancodec",
        "//pkg/util/sqlescape",
        "//pkg/util/sqlexec",
        "@com_github_pingcap_tipb//go-tipb",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "workloadlearning_test",
    timeout = "short",
    srcs = [
        "cache_test.go",
        "handle_test.go",
    ],
    flaky = True,
    shard_count = 4,
    deps = [
        ":workloadlearning",
        "//pkg/parser/ast",
        "//pkg/testkit",
        "@com_github_stretchr_testify//require",
    ],
)
